<?php if(!defined('IN_APP')) exit('Access Denied');?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>更换联系方式</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/swiper.min.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/reset.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/common.css">
	<link rel="stylesheet" href="<?php echo THEME_PATH;?>styles/style.css">	
</head>
<body>
	<!-- S header -->
	<header>
		<a href="/index.php?m=user&c=home&a=personal_info" class="headerL iconfont">&#xe69f;</a>
		<h1>更换联系方式</h1>
	</header>
	<!-- E header -->
	
	<ul class="change_num_box">
		<li class="flex">
			<label class="label">手机号</label>
			<div class="flex-1 input_box"><input type="text" placeholder="请输入新的手机号" name="mobile_phone" value="<?php echo $user_info['mobile_phone'] ? $user_info['mobile_phone'] : $user_info['username'];  ?>"></div>
		</li>
	</ul>

	<a href="javascript:;" class="btn">提交</a>
</body>
<script src="<?php echo THEME_PATH;?>js/jquery-1.8.3.min.js"></script>
<script src="<?php echo THEME_PATH;?>js/swiper.min.js"></script>
<script src="/statics/js/layer/layer.js"></script>
<script>
$('.btn').click(function(){
	var mobile_phone = $("input[name='mobile_phone']").val();
	if(!mobile_phone || !(/^1[34578]\d{9}$/.test(mobile_phone))){
		layer.msg('请输入正确格式的手机号');
		return;
	}
	$.ajax({
		url:'/index.php?m=user&c=home&a=change_mobile',
		type:'post',
		data:{
			mobile_phone:mobile_phone,
		},
		dataType:'json',
		success:function(data){
			if(data.status ==0){
				layer.msg(data.info);
			}else{
				layer.msg(data.info);
				setTimeout(function(){
							location.reload();
						},1000);
				return;
			}
		}
	})
})
</script>
</html>